﻿CREATE FUNCTION [audit].[GetTraceFilePath]
(@TraceID INT)
RETURNS VARCHAR (512)
AS
BEGIN
	DECLARE @ReturnValue varchar(512)

	DECLARE @FileNameFlag int
	SET @FileNameFlag = 2

	SELECT @ReturnValue = CAST([value] AS varchar(512))
	FROM :: fn_trace_getinfo(@TraceID)
	WHERE([traceid] = @TraceID)
	AND  ([property] = @FileNameFlag)

	RETURN(@ReturnValue)
END